package mya.mes.mdc.module.rest;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import mya.mes.mdc.model.tag.ViewTag;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.UUID;

public class Test {

    public static void main(String[] args) {
//        String en = "区域 1 : T110. 故障 324: 电机热故障 243QF5 (R060_T110.BD_Defaut3)";
//        en = en.replace("：", ":");
//        ViewTag viewTag = new ViewTag();
//        int firstIndex = en.indexOf(':');
//        if (firstIndex < 0) {
//            throw new RuntimeException("startIndex < 0");
//        }
//        int secondIndex = en.indexOf(':', firstIndex + 1);
//        if (secondIndex < 0) {
//            throw new RuntimeException("secondIndex < 0");
//        }
//        String str1 = en.substring(0, firstIndex).trim();
//        String str2 = en.substring(firstIndex + 1, secondIndex).trim();
//        if (str2.startsWith("故障") || str2.startsWith("Alarm")) {
//            viewTag.tagName = str2;
//        } else {
//            int split = str2.indexOf('.');
//            viewTag.tagName = str2.substring(0, split);
//        }


        String val = "[{\"property\":\"alarmDate\",\"value\":\"2020-06-29\",\"operator\":\">=\"},{\"property\":\"endDate\",\"value\":\"2020-06-03\",\"operator\":\"<=\"}]";

        JSONArray jsonArray = JSON.parseArray(val);
        System.out.println(jsonArray);

        LocalDateTime dateTime = LocalDateTime.now();

        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        DateTimeFormatter formatter_ = DateTimeFormatter.ofPattern("HH:mm:ss");
        System.out.println(dateTime.format(formatter));
        System.out.println(dateTime.format(formatter_));

        String uuid = UUID.randomUUID().toString();
        System.out.println(uuid.replace("-",""));


//        Integer integer =  new Integer("1.0");
//        System.out.println(integer);

//        boolean b =  new Integer(1);

    }
}